<template>
	<view>
		<view class="new-content">
			<view class="top">
				<view class="title">{{news.title}}</view>
				<view class="time">
					<u-icon name="clock" color="#999" size="12"></u-icon>
					<text class="ml-15">{{$u.timeFormat(news.createtime, 'yyyy-mm-dd')}}</text>
				</view>
			</view>
			<view class="content">
				<u-parse :content="news.content"></u-parse>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		getNewsDetail
	} from '@/config/api.js'
	export default {
		data() {
			return {
				id: '',
				news: {}
			};
		},
		onLoad(op) {
			this.id = op.id
			this.getDetail()
		},
		methods: {
			async getDetail() {
				const res = await getNewsDetail({
					id: this.id
				})
				if (res.code == 1) {
					this.news = res.data
				} else {
					uni.showToast({
						title: res.msg,
						icon: 'none'
					})
				}
			}

		}
	}
</script>
<style>
	page {
		background-color: #f8f8f8;

	}
</style>
<style lang="scss">
	.new-content {
		background-color: #ffffff;
		border-radius: 20rpx;
		padding: 40rpx;
		margin: 30rpx;

		.top {
			padding-bottom: 20rpx;
			border-bottom: 1px solid #eee;

		}

		.title {
			line-height: 1.5em;
			font-size: 38rpx;
		}

		.time {
			margin: 20rpx 30rpx;
			font-size: 20rpx;
			color: #999;
			display: flex;
			align-items: center;



		}

		.content {
			margin-top: 40rpx;
			text-indent: 2em;
			line-height: 2em;
			color: #333;
			font-size: 28rpx;

		}
	}
</style>